<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    
    <title>展会信息管理</title>
    
	<link rel="stylesheet" type="text/css" href="<%=path%>/JS/extjs/resources/css/ext-all.css"/>
	<link rel="stylesheet" type="text/css" href="<%=path%>/JS/extjs/ux/gridfilters/css/GridFilters.css" />
    <link rel="stylesheet" type="text/css" href="<%=path%>/JS/extjs/ux/gridfilters/css/RangeMenu.css" />
    
	<script type="text/javascript" src="<%=path%>/JS/extjs/adapter/ext-base.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ext-all.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ext-lang-zh_CN.js"></script>
	
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/menu/RangeMenu.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/menu/ListMenu.js"></script>
	
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/GridFilters.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/Filter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/StringFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/DateFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/ListFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/NumericFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/BooleanFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/jquery-1.7.2.js"></script>
	
	<script type="text/javascript">
	//选中行的ID
	var showInfoId = '';
	var showBannerImgPath='';//展会图片
	var data = "";
	var winUpload = null;
	var grid = null;//列表
	
	
	function openDialog(){
		Ext.useShims=true;

	    win=new Ext.Window({
		    	    //title:"新增",
	        	    width:790,
	        	    height:450,
	        	    modal:true,
	        	    closeAction:"close",
	        	    layout:"fit",
	        	    autoScroll:true,
	        	    items:[
						new Ext.FormPanel({
							id:"formPanel",
								frame:true,
								x:40,
						        y:30,
								labelAlign:"right",
						        width:770,
						        height:450,
						        enctype: 'multipart/form-data', 
						        border:false,
						        autoScroll:true,
						        waitMsgTarget: true,
						      //  region:"west",
						        reader : new Ext.data.JsonReader({
						        	//root:'showInfoList'
							        }, [
									{name:'id',mapping:'id'},
						            {name:'showName',mapping:'showName'}, 
						            {name:'showCompany',mapping:'showCompany'},
						            {name:'showTime',mapping:'showTime'}, 
						            {name:'showAddress',mapping:'showAddress'},
						            {name:'showContact',mapping:'showContact'},
						            {name:'showTel',mapping:'showTel'},
						            {name:'showFax',mapping:'showFax'},
						            {name:'showEmail',mapping:'showEmail'},
						            {name:'isAvailable',mapping:'isAvailable', type:'int'},
						            {name:'type',mapping:'type'},
						            {name:'urlChannel',mapping:'urlChannel'},
						            {name:'remark',mapping:'remark'}
						            ]),
						        items: [
						            new Ext.form.FieldSet({
						               	title: '展会信息',
						               	width:740,
						               	autoHeight: true,
						                defaultType: 'textfield',
						                items: [
						                        {
							                        fieldLabel: 'id',
							                        //emptyText: '如stam.qq.com',
							                        name: 'id',
							                        allowBlank: true,
							                        hidden   : true,//隐藏
							                        width:190
						                    	},{
							                        fieldLabel: '展会主题',
							                        //emptyText: '如stam.qq.com',
							                        name: 'showName',
							                        allowBlank: false,
							                        width:400
							                    }, {
							                        fieldLabel: '主办公司',
							                        //emptyText:'如123456@qq.com',
							                        name: 'showCompany',
							                        allowBlank: false,
							                        width:400
							                    }, {
							                        fieldLabel: '展会时间',
							                        emptyText:'如2013年5月16日-18日09:00-17:00 (换行用<br/>)',
							                        name: 'showTime',
							                        allowBlank: false,
							                        width:400
							                    }, 
							                    {
						                        fieldLabel: '展会地址',
							                       // emptyText:'如123456@qq.com',
							                        name: 'showAddress',
							                        allowBlank: false,
							                        width:400
							                    },{
							                        fieldLabel: '联系人',
								                       // emptyText:'如123456@qq.com',
								                        name: 'showContact',
								                        allowBlank: false,
								                        width:400
								                 },{
							                        fieldLabel: '联系电话',
								                       // emptyText:'如123456@qq.com',
								                        name: 'showTel',
								                        allowBlank: false,
								                        width:400
								                 },{
							                        fieldLabel: '联系传真',
							                       // emptyText:'如123456@qq.com',
							                        name: 'showFax',
							                        allowBlank: false,
							                        width:400
							                    },{
							                        fieldLabel: '联系邮箱',
							                       // emptyText:'如123456@qq.com',
							                        name: 'showEmail',
							                        allowBlank: false,
							                        vtype:"email",
							                        width:400
							                    },
								                new Ext.form.ComboBox({
								                        fieldLabel: '是否可用',
								                        //name:'isAvailable',
								                        hiddenName:'isAvailable',
								                        allowBlank:false,
								                        blankText:'不能为空',
								                        emptyText : '请选择',
								                        store: new Ext.data.ArrayStore({
								                            fields: ['abbr', 'isAvailable'],
								                            data : [
										                            [0,'否'],
										                            [1,'是']] 
								                        }),
								                        valueField:'abbr',
								                        displayField:'isAvailable',
								                        typeAhead: true,
								                        mode: 'local',
								                        triggerAction: 'all',
								                        selectOnFocus:true,
								                        width:190
								                    }),
							                    new Ext.form.ComboBox({
							                        fieldLabel: '是否是主展会',
							                        //name:'type',
							                        hiddenName:'type',
							                        allowBlank:false,
							                        blankText:'不能为空',
							                        emptyText : '请选择',
							                        store: new Ext.data.ArrayStore({
							                            fields: ['abbr', 'type'],
							                            data : [
									                            [0,'否'],
									                            [1,'是']] 
							                        }),
								                    valueField:'abbr',
							                        displayField:'type',
							                        typeAhead: true,
							                        mode: 'local',
							                        triggerAction: 'all',
							                        selectOnFocus:true,
							                        width:190
						                   	 	}),{
						                        	fieldLabel: '非主展会的链接参数',
							                        //emptyText:'如123456@qq.com',
							                        name: 'urlChannel',
							                        allowBlank: true,
							                        width:190
							                 },{//上面是第五行
							                     xtype:"htmleditor",
							                     fieldLabel:"展会介绍",
							                     name:"remark",
							                     anchor:"95%",
							                     allowBlank:false,
							                     enableAlignments:false,//去除左右对齐工具栏
							                     enableLists:false//去除列表工具栏
							           		}]
						            })
						        ]
						})
	   	        	    ],
	        	    buttons:[{
	        	    	text:"确认",handler:function(){
	        	    	save();
	        	    	
	        	    }}, {
		        	    text:"取消",handler:function(){
	        	    	win.close();
	        	    	}
			       	}]
	        	}); 
	    win.show();
		//点击右上角的关闭按钮后
	    win.on("close",function(){
		});
	}
	
	function save(){
		var formPanel = Ext.getCmp("formPanel");
		var formvalue = Ext.util.JSON.encode(formPanel.getForm().getValues());
		if(formPanel.getForm().isValid()){
			formPanel.getForm().submit({
				 	url : '${pageContext.request.contextPath}/showInfoManagerAction!updateOrInsert.action',
				 	contentType: "application/x-www-form-urlencoded; charset=utf-8",
				 	params:{formStr:encodeURIComponent(formvalue)},
                    success : function(response, options) {
    			  	 	//alert("*********" + options.result.data);
						Ext.Msg.alert('提示',  options.result.data,function(){
							if(options.result.data == '保存成功'){
								win.close();
								store.reload();
							}
						});
                    },
                    failure : function(form, action) {
                    	Ext.Msg.alert('提示', '保存失败！');
                    },
                    submitEmptyText: false,
                    waitMsg : '正在保存数据，稍后...'
			});
		}else{
			Ext.Msg.alert("提示","输入有错误");
		}
	}

	//等待提示
	function loadMask(msg){
		var loadMask = new Ext.LoadMask(Ext.getBody(),{msg:msg});
		return loadMask;
	}
	
	function deleteShowInfo(selID,store){
		var loadMask = new Ext.LoadMask(Ext.getBody(),{msg:"正在删除，请稍候..."});
		//var loadMask = loadMask();
		Ext.MessageBox.confirm("提示","确定删除？",function(btn){
			if(btn=="yes"){
				if(selID == ""){
					Ext.Msg.alert("提示","请选择删除行");
				}else if(selID != ""){
					loadMask.show();
					Ext.Ajax.timeout = 3 * 60 * 1000;
	        		Ext.Ajax.request({
	        		       url: '${pageContext.request.contextPath}/showInfoManagerAction!delete.action',
	        		       method : 'POST',
	        		       params:{selIDStr:selID},
	        			   success: function(response, options){
		        		   		var resultjson = Ext.util.JSON.decode(response.responseText);
	        			  	 	//alert("*********" + resultjson.data);
	        			  	 	refresh(store);
	        			  	 	loadMask.hide();
	            			   	Ext.Msg.alert("提示", resultjson.data);
	        		       },
	        			   failure : function(request){   
	        		           Ext.MessageBox.show({   
	        		                   title : '提示',   
	        		                    msg : "操作失败",   
	        		                    buttons : Ext.MessageBox.OK,   
	        		                    icon : Ext.MessageBox.ERROR   
	        		                    });   
	        		       }
	        		  });
				}
			}else if(btn=="no" || btn=="cancel"){
				//return false;
			}
		});
	}

	//刷新列表
	function refresh(store){
		store.reload();
		grid.getSelectionModel().clearSelections();
		showInfoId = '';
  		showBannerImgPath = '';
      	data = '';
		
	}
	
	function openUploadDialog(){
		Ext.useShims=true;
		var formUpload = new Ext.form.FormPanel({   
		    baseCls: 'x-plain',   
		    labelWidth: 80,   
            fileUpload : true,  
		    defaultType: 'textfield', 
		    autoScroll:true,
		    items: [{   
		      xtype: 'textfield',   
		      fieldLabel: '文件',   
		      name: 'upload',   
		      inputType: 'file',   
		      allowBlank: false,   
		      blankText: '请选择上传图片',   
		      anchor: '70%'  // anchor width by percentage   
		    },{
		    	xtype:'panel',
		    	border:false,
		    	html:'<img src="<%=path%>'+showBannerImgPath+'" width="500" height="100">',
		    	anchor: '100%'
		    }]   
		  });  
		winUpload = new Ext.Window({   
		    title: '上传图片',   
		    width: 525,   
		    height:210,   
		    minWidth: 300,   
		    modal:true,
		    minHeight: 100,   
		    layout: 'fit',   
		    plain:true,   
		    autoScroll:true,
		    bodyStyle:'padding:5px;',   
		    buttonAlign:'center',   
		    items: formUpload,   
		    buttons: [{   
		      text: '上 传',   
		      handler: function() {   
		        if(formUpload.form.isValid()){   
		          formUpload.getForm().submit({       
		            url:'${pageContext.request.contextPath}/showInfoManagerAction!uploadBannerImg.action?id='+showInfoId,   
		            success : function(response, options) {
    			  	 	//alert("*********" + options.result.data);
						Ext.Msg.alert('提示',  options.result.data,function(){
							if(options.result.data == '上传成功'){
								winUpload.close();  
								refresh(store);
							}
						});
                    },
		             failure: function(form, action){       
		              //... action生成的json{msg:上传失败},页面就可以用action.result.msg得到非常之灵活   
		              Ext.Msg.alert("提示",'上传失败');       
		             }   
		          });              
		        }   
		       }   
		    },{   
		      text: '取 消',   
		      handler:function(){winUpload.close();}   
		    }]   
		  });  
		winUpload.show();
	}
	
	
	</script>

  </head>
  
  <body>
    <script type="text/javascript">
    var audienceArr = Array();
    //当前选中行的id值
    var selID = "";
    var store = null;
    var type;
    
  		$(function(){
  			//当ajax写在此处时，会先加载页面，然后才会有json数据，所以，要在json数据返回以后，再回载页面
  		});
  		function InitMain(){
		    
		    var url = document.location.href;
			var arrStr = url.substring(url.indexOf("?")+1).split("&");
			type=arrStr[0].replace("type=","");
			var encode = false;
			var local = true;//当前页查询，false为远程查询
		    
			//复选框
			var sm = new Ext.grid.CheckboxSelectionModel({checkOnly:false});
			//列过滤
			var filters = new Ext.ux.grid.GridFilters({
		        encode: encode,
		        local: local,
		        filters: [{
		            type: 'string',
		            dataIndex: 'showName'
		           // disabled: true
		        }, {
		            type: 'string',
		            dataIndex: 'showCompany'
		        }, {
		            type: 'string',
		            dataIndex: 'showAddress'
		        }, {
		            type: 'string',
		            dataIndex: 'showContact'
		        }, {
		            type: 'string',
		            dataIndex: 'showTel'
		        }, {
		            type: 'string',
		            dataIndex: 'showFax'
		        }, {
		            type: 'string',
		            dataIndex: 'showEmail'
		        }, {
		            type: 'string',
		            dataIndex: 'type'
		        }, {
		            type: 'string',
		            dataIndex: 'urlChannel'
		        }, {
		            type: 'string',
		            dataIndex: 'isAvailable'
		        }, {
		            type: 'string',
		            dataIndex: 'createTime'
		        }]
		    });
  			var cm = new Ext.grid.ColumnModel([
										  sm,
   	  	                 	  	          {
   	  	              	  	                  header   : '主键', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'id'
   	  	              	  	              },{
   	  	              	  	                  header   : '展会名称', 
   	  	              	  	                  width    : 40, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'showName'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '主办公司', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  //renderer : showSex,
   	  	              	  	                  dataIndex: 'showCompany'
   	  	              	  	              },{
   	  	              	  	                  header   : '展会地址', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'showAddress'
   	  	              	  	              },{
   	  	              	  	                  header   : '展会时间', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'showTime'
   	  	              	  	              },{
   	  	              	  	                  header   : '联系人', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  //hidden   : true,
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'showContact'
   	  	              	  	              },{
   	  	              	  	                  header   : '联系电话', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true,
   	  	              	  	         		  //hidden   : true,
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'showTel'
   	  	              	  	              },{
   	  	              	  	                  header   : '联系传真', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  //hidden   : true,
   	  	              	  	                  // renderer : 'usMoney',
   	  	              	  	                  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          }, 
   	  	              	  	                  dataIndex: 'showFax'
   	  	              	  	              },{
   	  	              	  	                  header   : '联系邮箱', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  //hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'showEmail'
   	  	              	  	              },{
   	  	              	  	                  header   : '是否主展会', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			  		  //hidden   : true,
   	  	              	  			  		  renderer : isVailable,
   	  	              	  			 		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'type'
   	  	              	  	              },{
   	  	              	  	                  header   : '副展会的链接参数', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			 		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'urlChannel'
   	  	              	  	              },{
   	  	              	  	                  header   : '是否可用', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			  		  //hidden   : true,
   	  	              	  			  		  renderer : isVailable,
   	  	              	  			 		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'isAvailable'
   	  	              	  	              },{
   	  	              	  	                  header   : '创建时间', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			 		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'createTime'
   	  	              	  	              },{
   	  	              	  	                  header   : 'hearderImgPath', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  hidden   : true,
   	  	              	  	                  dataIndex: 'hearderImgPath'
   	  	              	  	              },{
   	  	              	  	                  header   : 'remark', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  hidden   : true,
   	  	              	  	                  dataIndex: 'remark'
   	  	              	  	              },{
   	  	              	  	                  header   : 'webUrl', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  hidden   : true,
   	  	              	  	                  dataIndex: 'webUrl'
   	  	              	  	              }
   	  	              	  	          ]);

    	 // 	var proxy = new Ext.data.MemoryProxy(audienceArr);
    	 	var proxy = new Ext.data.HttpProxy({
        	 	url:'${pageContext.request.contextPath}/showInfoManagerAction!search.action',
        	 	method:'post'
        	});
    	  	var record = Ext.data.Record.create([
    	  	                            {},
    	  	               				{name: 'id'},
    	  	          					{name: 'showName'},
    	  	          					{name: 'showCompany'},
    	  	          					{name: 'showAddress'},
    	  	          					{name: 'showTime'},
    	  	          					{name: 'showContact'},
    	  	          					{name: 'showTel'},
    	  	          					{name: 'showFax'},
    	  	          					{name: 'showEmail'},
    	  	          					{name: 'type'},
    	  	          					{name: 'urlChannel'},
    	  	          					{name: 'isAvailable'},
    	  	          					{name: 'createTime'},
    	  	          					{name: 'hearderImgPath'},
    	  	          					{name: 'remark'},
    	  	          					{name: 'webUrl'}
    	  	            	  	          ]);
  	          var reader = new Ext.data.JsonReader({
  	        	  totalProperty:'totalcount',
  	  	          root:'showInfoList'
  	  	          },record);


  	  	      store = new Ext.data.Store({
  	  	          proxy:proxy,
  	  	          reader:reader
  	  	      });
  	  	  	  store.load({
  	  	  			params : {
  	  	  	     	start : 0,
  	  	  	     	limit : 9
  	  	  	    }
  	  	  	  });

			  //用户是否可用
	  	  	  function isVailable(val) {
	  	        if (val == 0) {
	  	            return '否';
	  	        } else if (val == 1) {
	  	            return '是';
	  	        }
	  	        return val;
	  	      }

  	  	      // create the Grid
  	  	      grid = new Ext.grid.GridPanel({
  	  	          store: store,
  	  	     	  cm: cm,
  	  	          stripeRows: true,
  	  	          autoExpandColumn: 'id',
  	  	          height: 250,
  	  	          width: "100%",
  	  	      	  plugins: [filters],
  	  	      	  loadMask: true,
	  	  	     // sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
	  	  	      sm: sm,
	  			  viewConfig: {
	  				  forceFit: true
	  			  },
  	  	          stateful: true,
  	  	          stateId: 'grid',
  	  	      	  columnLines: true,
  	  	          region:"north",
  	  	          //分页
	  	  	      bbar: new Ext.PagingToolbar({
	  	            pageSize: 9,
	  	            store: store,
	  	            displayInfo: true,
	  	            plugins: [filters],
	  	            displayMsg: '当前 {0} 到 {1}条 共 {2}条',
	  	            emptyMsg: "没有记录",
	  	            items:[
	  	                ]
	  	        })
  	  	      });
          	//加载过滤按钮
          	grid.getBottomToolbar().add([
          		'->',
                {
                    text: '清除过滤',
                    handler: function () {
                        grid.filters.clearFilters();
                    } 
                },{
                    text: '重新加载',
                    handler: function () {
                        grid.reconfigure(store, cm);
                    } 
                },"-"
          		
          	]);
          	
          //显示展会明细
          //点击行数据显示问卷调查信息
      	  var ct = new Ext.Panel({
      		//renderTo: 'binding-example',
      		frame: true,
      		//title: 'Book List',
      		width: 540,
      		height: 400,
      		layout: 'border',
      		region:'center',
      		items: [
      			grid,
      			{
      				id: 'detailPanel',
      				region: 'center',
      				autoScroll:true,
      				bodyStyle: {
      					//background: '#ffffff',
      					padding: '7px'
      				},
      				html: '<b>请选择一行数据查看详细信息。</b>'
          			}
          		]
          	});
          	//提示等待
      		var getQInfoMask = new Ext.LoadMask(Ext.getBody(),{msg:"正在获取信息，请稍候..."}); 

          	grid.getSelectionModel().on('rowselect', function(sm, rowIdx, r){
          		//提示等待
          		getQInfoMask.show(); 
          		//点击选中行，修改
          		showInfoId = r.data.id;
          		showBannerImgPath = r.data.hearderImgPath;
              	data = r.data;
          		
              	var id = r.data.id;
              	//alert(r.data.audience_city);
              	var showName = r.data.showName;
              	var showCompany = r.data.showCompany;
              	var showTime = r.data.showTime;
              	var showAddress = r.data.showAddress;
              	var showTel = r.data.showTel;
              	var showFax = r.data.showFax;
              	var showEmail = r.data.showEmail;
              	var showContact = r.data.showContact;
              	var createTime = r.data.createTime;
              	var isAvailable = r.data.isAvailable;
              	var type = r.data.type;
              	var urlChannel = r.data.urlChannel;
              	var webUrl = r.data.webUrl;
              	
              	var bookTplStr = "";
   			  	bookTplStr = "<table border='1' width='100%' align='left' cellpadding='0' cellspacing='0' style='margin-top:0px;font-size:15px;'>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td width='110'><b>展会名称</b></td><td  colspan='7'>"+showName+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>展会地址</b></td><td colspan='7'>"+showAddress+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>展会时间</b></td><td colspan='7'>"+showTime+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>主办公司</b></td><td colspan='7'>"+showCompany+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>联系人</b></td><td>"+showContact+"</td>"
		  		+"<td><b>联系人电话</b></td><td>"+showTel+"</td>"
		  		+"<td><b>传真</b></td><td>"+showFax+"</td>"
		  		+"<td><b>邮箱</b></td><td>"+showEmail+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>是否有效</b></td><td>"+(isAvailable=='1'?'是':'否')+"</td>"
		  		+"<td><b>是否主展会</b></td><td>"+(type=='1'?'是':'否')+"</td>"
		  		+"<td><b>展会链接参数</b></td><td colspan='3'>"+urlChannel+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>创建时间</b></td><td colspan='2'>"+createTime+"</td>"
		  		+"<td><b>展会地址</b></td><td colspan='4'><a href='"+webUrl+"' target='_blank'>"+webUrl+"</a></td>"
		  		+"</tr>"
   			  	+"</table>";
   			  	//alert(bookTplStr);

   			  	//var bookTplMarkup = ["用户名: {audience_name},<br/>手机: {audience_mobile},<br/>电子邮箱: {audience_email},<br/>Product Group: {ProductGroup}<br/>"];
           		var bookTplMarkup = [bookTplStr];
       	  	    var bookTpl = new Ext.Template(bookTplMarkup);
  	           	//alert(sm + "-----" + rowIdx + "\r\n" + Ext.util.JSON.encode(r.data));
           		var detailPanel = Ext.getCmp('detailPanel');
           		bookTpl.overwrite(detailPanel.body, "");
              		
           		//隐藏等待
           		getQInfoMask.hide();

          	});
          	grid.getSelectionModel().on('rowdeselect', function(sm, rowIdx, r){
              //	alert(1111);
              	var bookTplMarkup = ['<b>请选择一行数据查看详细信息。</b>'];
      	  	    var bookTpl = new Ext.Template(bookTplMarkup);
          		var detailPanel = Ext.getCmp('detailPanel');
          		bookTpl.overwrite(detailPanel.body, '');
          	});
          	
  	  	  var centerPanel = new Ext.Panel({
	  	  		id:"centerPanel",
	  	  		layout:"border",
	  	  		region:"center",
	  	  		width:"75%",
	  	  		tbar:[//定义顶部工具栏
	  	  		  {
	         	      id:'addnode',
	                   text: '新增',
	                   iconCls:'add',
	                   //iconCls : 'edit',
	                   //pressed : true,
	                   handler : function(){
	 				   		openDialog();
	 				   		win.setTitle("新增");
	                   }
	                  },'-',{
	         	      id:'updatenode',
	                   text: '修改',
	                   iconCls : 'option',
	                   //pressed : true,
	                   handler : function(){
	                	  if(showInfoId == ''){
		                	  Ext.Msg.alert("提示","请选择修改行");
	                	  }else{
		                   openDialog();
		                   win.setTitle("修改");
		                   Ext.getCmp("formPanel").form.loadRecord(new Ext.data.MemoryProxy(data));
	                	  }
		                   }
	                  },'-',{
			         	      id:'deletenode',
			                   text: '删除',
			                   iconCls : 'remove',
			                   //pressed : true,
			                   handler : function(){
			                       var obArr = sm.getSelections();
			                   	   var selIDStr = "";
			                   	   if(obArr.length == 0){
				                   	   Ext.Msg.alert("提示","没有选中行");
				                   	   return;
			                   	   }
			                   	   for(var i=0;i<obArr.length;i++){
				                   	   if(selIDStr > 0){
				                   			selIDStr += ",";
				                   	   }
			                   			selIDStr += obArr[i].id;
			                   	   }
			                   	   deleteShowInfo(selIDStr,store);
				              }
			           },"-",{
		                	  
		                	  id:'upHeaderImg',
			                  text: '上传图片',
			                  iconCls : 'refresh',
			                  //pressed : true,
			                  handler : function(){
			                	  if(showInfoId == ''){
				                	  Ext.Msg.alert("提示","请选择修改行");
			                	  }else{
			                		  openUploadDialog();
			                	  }
		                  	  }
		               },"-",{
	                	  
	                	  id:'refresh',
		                  text: '刷新',
		                  iconCls : 'refresh',
		                  //pressed : true,
		                  handler : function(){
	                	  refresh(store);
	                  	  }
	                  }],
	  	  		items:[
						//grid
						ct
	   	  	  		]
	  	  		
	  		});
  	  	var viewport = new Ext.Viewport({
			id : 'viewprot',
			layout : 'border',
			items : [
					centerPanel
				]
		});
//		}  
	//});
  	}
  		Ext.onReady(InitMain); 
  	
  	
  	</script>
  </body>
</html>
